﻿@page "/tests/treeview"
<Row>
    <Column ColumnSize="ColumnSize.Is12" Margin="Margin.Is4.OnY">
        <Card>
            <CardHeader>
                <CardTitle>TreeView</CardTitle>
            </CardHeader>
            <CardBody>
                <CardText>Treeview allows the display of hierarchical information in a tree-like structure.</CardText>
            </CardBody>
            <CardBody>
                <TreeView Nodes="Nodes"
                          @bind-SelectedNode="selectedNode"
                          @bind-ExpandedNodes="ExpandedNodes"
                          GetChildNodes="@(item => item.Children)"
                          HasChildNodes="@(item => item.Children?.Any() == true)"
                          NodeStyling="@((item, style) => { style.TextColor = (item.Children?.Any() == true) ? TextColor.Primary : TextColor.Dark; style.Style = "font-weight:bold"; })"
                          SelectedNodeStyling="@((item, style) => {style.Background = Background.Primary; style.TextColor = TextColor.White; })">
                    <NodeContent>
                        <Icon Name="IconName.Folder" />
                        @context.Text
                    </NodeContent>
                </TreeView>
            </CardBody>
        </Card>
    </Column>
</Row>